home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / xview / genial / func / conf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-14  |  2.7 KB  |  133 lines

  1. /*
  2.  * conf.c -- connection between analytic functions and rest of GENIAL
  3.  */
  4.  
  5. #include <stdio.h>
  6. #include "ui.h"
  7. #include "conf.h"
  8. #include "log.h"
  9.  
  10. static int cfunc = 0;        /* current function */
  11.  
  12. int 
  13. nofunc()
  14. {
  15.     return 0;
  16. }
  17.  
  18. extern int anot_init(), anot_eval(), anot_clear(), anot_change();
  19.  
  20. extern int zoom_init(), zoom_eval(), zoom_clear();
  21.  
  22. extern int ames_init(), ames_eval(), ames_clear(), 
  23.     ames_reset(), ames_change();
  24.  
  25. extern int dist_init(), dist_eval(), dist_clear();
  26.  
  27. extern int trace_init(), trace_eval(), trace_clear(), trace_reset(),
  28.           trace_change();
  29.  
  30. extern int histo_init(), histo_eval(), histo_clear(), 
  31.     histo_reset(), histo_change();
  32.  
  33. extern int cmtfile_init(), cmtfile_clear(), cmtfile_reset();
  34.  
  35. struct fxnsw fxnsw[] =
  36. {
  37.     {trace_init, trace_eval, trace_clear, trace_reset, trace_change},
  38.     {histo_init, histo_eval, histo_clear, histo_reset, histo_change},
  39.     {zoom_init, zoom_eval, zoom_clear, NULL, zoom_eval},
  40.     {dist_init, dist_eval, dist_clear, NULL, dist_eval},
  41.     {ames_init, ames_eval, ames_clear, ames_reset, ames_eval},
  42.     {anot_init, anot_eval, anot_clear, NULL, anot_change},
  43.     {cmtfile_init, NULL, cmtfile_clear, cmtfile_reset, NULL},
  44. };
  45.  
  46.  
  47. fxn_init()
  48. {
  49.     if (fxnsw[cfunc].f_init != NULL) {
  50.     if ((*fxnsw[cfunc].f_init) () == -1) {
  51.         clear_info();
  52.         lab_info("Error attempting to initialize function!", 1);
  53.     }
  54.     }
  55. #ifdef DEBUG
  56.     printf("fxn_init\n");
  57. #endif
  58. }
  59.  
  60. fxn_eval()
  61. {
  62.     if (fxnsw[cfunc].f_eval != NULL) {
  63.     if ((*fxnsw[cfunc].f_eval) () == -1) {
  64.         clear_info();
  65.         lab_info("Error attempting to eval function!", 1);
  66.     }
  67.     draw_log();
  68.     XFlush(display);
  69.     }
  70. #ifdef DEBUG
  71.     printf("fxn_eval\n");
  72. #endif
  73. }
  74.  
  75. fxn_change(id)
  76. int id;
  77. {
  78.     if (fxnsw[cfunc].f_change != NULL) {
  79.     if ((*fxnsw[cfunc].f_change) (id) == -1) {
  80.         clear_info();
  81.         lab_info("Error attempting to eval function!", 1);
  82.     }
  83.     draw_log();
  84.     }
  85. #ifdef DEBUG
  86.     printf("fxn_change\n");
  87. #endif
  88. }
  89.  
  90. /* note: fxn_clear routines should not attempt to clear the points in the
  91.    region or the crosses.  leave that to to log_del() */
  92. fxn_clear(log)
  93. struct logent *log;
  94. {
  95.     if (fxnsw[log->opcode].f_clear != NULL) {
  96.     if ((*fxnsw[log->opcode].f_clear) (log->id) == -1) {
  97.         clear_info();
  98.         lab_info("Error attempting to clear function!", 1);
  99.     }
  100.     draw_log();
  101.     log->trace = NULL;
  102.     log->hist = NULL;
  103.     log->zoom = NULL;
  104.     }
  105. #ifdef DEBUG
  106.     printf("fxn_clear\n");
  107. #endif
  108. }
  109.  
  110. fxn_reset()
  111. {
  112.     if (fxnsw[cfunc].f_reset != NULL) {
  113.     if ((*fxnsw[cfunc].f_reset) () == -1) {
  114.         clear_info();
  115.         lab_info("Error attempting to initialize function!", 1);
  116.     }
  117.     }
  118. #ifdef DEBUG
  119.     printf("fxn_reset\n");
  120. #endif
  121. }
  122.  
  123. fxn_select(fid)
  124.     int       fid;
  125. {
  126.     cfunc = fid;
  127.     curfunc->opcode = fid;
  128.  
  129. #ifdef DEBUG
  130.     printf("fxn_select:%d\n", fid);
  131. #endif
  132. }
  133.